home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / tpatch.zip / TPATCH.DOC < prev   
Text File  |  1987-03-18  |  13KB  |  263 lines

  1.  
  2.            *****************************************************
  3.            * TPATCH: Turbo File Patching Utility, Version 2.00 *
  4.            *****************************************************
  5.  
  6.              (C) Copyright 1987 Brian Foley, TurboPower Software
  7.                            CompuServe 76317,3247
  8.  
  9.     This program is released into the public domain for personal,
  10.     non-commercial use only. It may be freely copied and distributed so
  11.     long as no fee is charged, either for the program itself or the
  12.     distribution of it.
  13.  
  14. What TPATCH does
  15. ================
  16. TPATCH.COM is a utility for programs compiled with Turbo Pascal (PC-DOS,
  17. versions 3.00B-3.02A). It allows you to examine the status of certain
  18. settings--colors, mIn and mAx heap, display mode, etc.--and, if requested,
  19. to change them without recompiling. It also allows you to make a few
  20. simple patches to Turbo compilers. Here is the output that would be
  21. generated by entering
  22.  
  23.      TPATCH tpatch
  24.  
  25. at the command line (I've added the numbers to the left, in parentheses):
  26.  
  27.       TPATCH, Turbo File Patching Utility, Version 2.00
  28.       (C) Copyright 1986 by Brian Foley
  29.       Examining TPATCH.COM
  30.  (1)  Compiled with Turbo Pascal version 3.01A (plain vanilla)
  31.  (2)  Monochrome
  32.  (3)    NormVideo        $0F (White on Black)
  33.  (4)    LowVideo         $07 (Light Gray on Black)
  34.       Black & white
  35.         NormVideo        $0F (White on Black)
  36.         LowVideo         $07 (Light Gray on Black)
  37.       Color
  38.         NormVideo        $0E (Yellow on Black)
  39.         LowVideo         $07 (Light Gray on Black)
  40.  (5)  Display mode       $FF "Default display mode"
  41.  (6)  Device checking  {$D+}
  42.  (7)  ^Break checking  {$C+}
  43.  (8)  ^C checking      {$U-}
  44.  (9)  Code size        $0564 paragraphs
  45. (10)  Data size        $003D paragraphs
  46. (11)  mIn stack        $0400 paragraphs
  47. (12)  mAx stack        $2000 paragraphs
  48. (13)  Input buffer     (N/A)
  49. (14)  Output buffer    (N/A)
  50.  
  51. -P and -O options
  52. =================
  53. If you want to change some of these items, use the "-P" (Patch Mode) option and
  54. you will be prompted for new settings. By default, any changes you request
  55. will be made directly to the COM file itself. If you want to play it safe,
  56. you can have TPATCH write a new version of the program that incorporates
  57. the changes by using the "-O" (Output file) option and specifying a
  58. filename. If the "-O" option is specified, Patch Mode is selected
  59. automatically.
  60.  
  61. Items displayed, Making changes
  62. ===============================
  63.      (1) Version: The version of the Turbo compiler that was used to
  64.          generate the executable file. TPATCH recognizes the runtime
  65.          library for most DOS versions of the Turbo compiler, from 1.00A up
  66.          to 3.02A. However, it will only report the default settings for,
  67.          and permit changes to, programs compiled with PC-DOS Turbo 3.00B
  68.          and higher (including BCD and 8087 versions).
  69.      (2) Monochrome (Black & white, Color): The runtime library keeps three
  70.          sets of video attributes--one for monochrome adapters, one for
  71.          composite black and white monitors attached to color cards, and
  72.          one for color monitor-adapter combinations.
  73.      (3) NormVideo: The video attribute used for NormVideo (aka HighVideo),
  74.          the default. If you aren't familiar with video attributes, but
  75.          want to change them, here's a simple Pascal function that takes
  76.          foreground and background colors as parameters, and returns a
  77.          video attribute (with the blink bit masked out):
  78.  
  79.          function Attribute(Foreground, Background : Byte) : Byte;
  80.          {-Translates foreground and background colors into video attributes.
  81.            "And 127" masks out the blink bit. Add 128 to the result to set it.}
  82.          begin
  83.            Attribute := ((Background shl 4)+Foreground) and 127;
  84.          end;
  85.  
  86.          You may change NormVideo for any or all of the three sets of
  87.          attributes. Number must be in the range 0-$FF (enter in decimal or
  88.          hex, either one).
  89.      (4) LowVideo: The video attribute used for LowVideo. You may change
  90.          LowVideo for any or all of the three sets of attributes. Number
  91.          must be in the range 0-$FF (enter in decimal or hex, either one).
  92.      (5) Display mode: A Turbo compiler fresh out of the package will have
  93.          $FF (= default display mode) here, which is what it should be.
  94.          If you need to change this, the valid entries are:
  95.  
  96.               0 : b/w   display 40x25
  97.               1 : Color display 40x25
  98.               2 : b/w   display 80x25
  99.               3 : Color display 80x25
  100.               7 : Monochrome display
  101.             $FF : Default display mode
  102.  
  103.          The string that goes with this byte is shown in quotation marks.
  104.          If you alter the mode, TPATCH supplies the corresponding string.
  105.          Enter the appropriate number in decimal or hex, either one.
  106.      (6) Device checking: Default is D+. You may change this by entering
  107.          '-' (just the minus) for $D- or '+' (just the plus) for $D+. This
  108.          option does nothing unless the program uses DOS standard I/O. If
  109.          $D- is used, all I/O is buffered, no matter what.
  110.      (7) ^Break checking: Default is $C+. You may change this by entering
  111.          '-' (just the minus) for $C- or '+' (just the plus) for $C+.
  112.          Affects only the *initial* setting for CBreak (the well-known
  113.          global variable), which determines whether break checking is on.
  114.      (8) ^C checking: Default is $U-. You may change this by entering '-'
  115.          (just the minus) for $U- or '+' (just the plus) for $U+. When you
  116.          set $U+ (anywhere in your program, but normally at the top), the
  117.          compiler fills your program with breakpoint instructions (INT
  118.          3's), and sets a flag telling the runtime library to install an
  119.          interrupt handler to trap INT 3 and check for a ^C at *every*
  120.          breakpoint. TPATCH lets you determine whether that interrupt
  121.          handler gets installed or not by setting the flag on or off. You
  122.          can thus speed up the execution of a program compiled with $U+ (a
  123.          bit), since the default INT 3 handler will *usually* point to a
  124.          simple IRET. Or you can simulate a selective $U+ by inserting
  125.          "Inline($CC);" statements into your code at strategic locations
  126.          (as opposed to everywhere) and use TPATCH to see that the
  127.          interrupt handler gets installed.
  128.      (9) cOde size: There is no reason for changing this unless you are
  129.          using chain files. If you are, you'll know what this is good for;
  130.          if not, don't worry. You may enter *any* integer value here (the
  131.          number of 16-byte paragraphs), either in decimal or in hex, so be
  132.          careful.
  133.     (10) Data size: Ditto.
  134.     (11) mIn heap: mIn will usually be $400 paragraphs (16K bytes). You
  135.          may enter any integer value in the range $40-$B000 (paragraphs)
  136.          here, either in decimal or in hex.
  137.     (12) mAx heap: mAx will usually be set to $A000 paragraphs (640K
  138.          bytes), insuring that all available memory gets allocated for your
  139.          program. You may enter any integer value in the range $40-$B000
  140.          (paragraphs) here, either in decimal or in hex.
  141.     (13) Input buffer: The size of the buffer created with the $G (Get)
  142.          compiler directive, used to permit redirected input. "(N/A)" is
  143.          displayed if the buffer size is 0, indicating that redirection is
  144.          not enabled. This value cannot be changed. (At least not in this
  145.          version--I'm not sure it's safe.)
  146.     (14) Output buffer: The size of the buffer created with the $P (Put)
  147.          compiler directive, used to permit redirected output. "(N/A)" is
  148.          displayed if the buffer size is 0, indicating that redirection is
  149.          not enabled. This value cannot be changed. (Again, not sure it's
  150.          safe.)
  151.  
  152. -I and -A options
  153. =================
  154. New in TPATCH 2.00 are the -I and -A options, which give you an easy way
  155. to do nothing except reset mIn (-I) and mAx (-A) heap settings. If you use
  156. CED, you may want to define a synonym such as
  157.  
  158.   minmax syn 'tpatch %1 -i $%2 -a $%3'
  159.  
  160. If you're one of the six people who don't, you could also construct a
  161. batch file to accomplish the same thing. These options can also be used to
  162. reset the default mIn/mAx on Turbo compilers. (See the discussion of the
  163. -S option, below.)
  164.  
  165. -C option
  166. =========
  167. Those are the settings that are shown ordinarily. If you select the "-C"
  168. option, however, things look a little different. This option activates
  169. "Colors Only Mode". It is selected automatically if the .COM file being
  170. examined is a Turbo compiler. If Colors Only Mode is activated, items (6)
  171. through (14) are not shown. Instead, two more attribute settings are
  172. displayed for each of the three sets: "Marked blocks" (the attribute used
  173. to display marked blocks inside the Turbo editor) and "Error messages" (the
  174. attribute used to display error messages both in the editor and in the
  175. compiler--the kind that require you to press the Escape key to continue).
  176. These are displayed and changed in the same manner as NormVideo and
  177. LowVideo. In addition, the status of the "Snow checking" flag is shown
  178. (TINST asks if your display "flickers when it scrolls"--not quite
  179. accurate). (All of the extra items are in the runtime libraries of programs
  180. compiled with Turbo, but they aren't used.) Entering [Y] turns Snow
  181. Checking on, [N] turns it off.
  182.  
  183. If you use plain vanilla Turbo 3.01A and you enter
  184.  
  185.      TPATCH turbo
  186.  
  187. at the command line, this is what the display will look like:
  188.  
  189.       TPATCH, Turbo File Patching Utility, Version 2.00
  190.       (C) Copyright 1987 by Brian Foley
  191.       Examining TURBO.COM
  192.       This is Turbo Pascal version 3.01A (plain vanilla)
  193.       Monochrome
  194.         NormVideo        $0F (White on Black)
  195.         LowVideo         $07 (Light Gray on Black)
  196.         Marked blocks    $07 (Light Gray on Black)
  197.         Error messages   $70 (Black on Light Gray)
  198.       Black & white
  199.         NormVideo        $0F (White on Black)
  200.         LowVideo         $07 (Light Gray on Black)
  201.         Marked blocks    $07 (Light Gray on Black)
  202.         Error messages   $70 (Black on Light Gray)
  203.       Color
  204.         NormVideo        $0E (Yellow on Black)
  205.         LowVideo         $07 (Light Gray on Black)
  206.         Marked blocks    $07 (Light Gray on Black)
  207.         Error messages   $4F (White on Red)
  208.       Snow checking       ON
  209.       Display mode       $FF "Default display mode"
  210.  
  211. Although the "-C" option is intended mainly for Turbo compilers, it is
  212. perfectly acceptable to use it with your own programs. (See the
  213. discussion of the -F option, below.)
  214.  
  215. -S option
  216. =========
  217. Also new in TPATCH 2.00 is the -S option, to Show all compiler options
  218. (well, all that TPATCH knows about). This allows you to examine the
  219. default settings for mIn and mAx heap, as well as the more common compiler
  220. directives. After displaying the usual compiler information discussed
  221. above, TPATCH will ask you to press a key to continue, then display the
  222. following:
  223.  
  224.       mIn stack        $0400 paragraphs
  225.       mAx stack        $A000 paragraphs
  226.       I/O checking     {$I+}
  227.       Range checking   {$R-}
  228.       Break checking   {$C+}
  229.       ^C checking      {$U-}
  230.       Stack checking   {$K+}
  231.       Type checking    {$V+}
  232.       Device checking  {$D+}
  233.  
  234. As with compiled programs, these settings can be changed if Patch Mode
  235. (-P) is in effect. Before changing any of these, be sure to consider
  236. carefully the consequences, especially if you are in the habit of
  237. distributing the source code for your programs.
  238.  
  239. -F option
  240. =========
  241. Selects the Fast screen update option, which installs the alternate ConOut
  242. driver from my CONOUT.PAS. By default, this option must be selected each
  243. time you run the program. However, if you wish, you can patch TPATCH to
  244. install the driver automatically. To do so, run TPATCH on itself in Colors
  245. Only Mode by entering
  246.  
  247.      TPATCH tpatch -C -P [-O newfile]
  248.  
  249. Press [Enter] at all the prompts except the "Snow checking" one--for it,
  250. answer [N]. The alternate driver will then always be installed, and the -F
  251. option ignored. Try the -F option first before making the patch. (Please
  252. don't distribute altered versions of TPATCH.)
  253.  
  254. Default extension
  255. =================
  256. TPATCH always assumes that the extension for a filename passed to it as a
  257. parameter is .COM -- you can include it or omit it, doesn't matter.
  258.  
  259. Feedback
  260. ========
  261. That's it. Let me know if you have any comments, complaints, bug reports,
  262. etc. As noted above, I can be reached via CompuServe [76317,3247].
  263.